package com.carrod.listener;

import java.util.ArrayList;
import java.util.List;

public class ListenerManager {
	private static ListenerManager listenerManager = null;
	private ListenerManager(){
		
	}
	
	public static ListenerManager getInstance(){
		if(listenerManager == null){
			listenerManager = new ListenerManager();
			return listenerManager;
		}
		return listenerManager;
	}
	
	private List<Listener> listeners = new ArrayList<Listener>();
	
	public void fireEvent(Event event){
		for (Listener listener : listeners) {
			listener.fireChange(event);
		}
	}
	
	public void registerListener(Listener listener){
		listeners.add(listener);
	}
}
